package dp;

/**
 * 375. 猜数字大小 II
 */
public class P375 {
    public int getMoneyAmount(int n) {
        int left = 1, right = n, total = 0;
        while (left < right) {
            left = (left + right) / 2 + 1;
            total += left - 1;
        }
        return total;
    }

    public static void main(String[] args) {
        System.out.println(new P375().getMoneyAmount(10));
    }
}
